package com.acwing.partition9;

import java.io.*;
import java.util.Arrays;

/**
 * @author `RKC`
 * @date 2021/12/1 9:34
 */
public class AC840模拟散列表 {

    public static void main(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));
        String[] s = reader.readLine().split(" ");
        int n = Integer.parseInt(s[0]);
//        HashTable01 ht = new HashTable01();
        HashTable02 ht = new HashTable02();
        while (n-- > 0) {
            s = reader.readLine().split(" ");
            if ("I".equals(s[0])) {
                ht.put(Integer.parseInt(s[1]));
            } else if ("Q".equals(s[0])) {
                if (ht.contains(Integer.parseInt(s[1]))) writer.write("Yes\n");
                else writer.write("No\n");
                writer.flush();
            }
        }
    }

    private static class HashTable01 {
        //取大于1e5的第一个质数，取质数冲突的概率最小
        private static final int N = 100003;
        private int[] element = new int[N];
        private int[] head = new int[N];
        private int[] next = new int[N];
        private int index = 0;

        public HashTable01() { Arrays.fill(head, -1); }

        public void put(int x) {
            int key = hashKey(x);
            element[index] = x;
            next[index] = head[key];
            head[key] = index++;
        }

        private boolean contains(int x) {
            int key = hashKey(x);
            for (int i = head[key]; i != -1; i = next[i]) {
                if (element[i] == x) return true;
            }
            return false;
        }

        private int hashKey(int x) {
            return (x % N + N) % N;
        }
    }

    private static class HashTable02 {
        private static final int N = 200003;
        private int[] element = new int[N];

        public HashTable02() { Arrays.fill(element, 0x3f3f3f3f); }

        public void put(int x) { element[getOrIndex(x)] = x; }

        public boolean contains(int x) { return element[getOrIndex(x)] != 0x3f3f3f3f; }

        //查找x，如果x存在，则返回x的索引，否则，返回应该插入的位置
        private int getOrIndex(int x) {
            int key = (x % N + N) % N;
            while (element[key] != 0x3f3f3f3f && element[key] != x) {
                key++;
                if (key == N) key = 0;
            }
            return key;
        }
    }
}
